//
//  CCFindDetailCell.m
//  CwinCar
//
//  Created by dlios on 15/10/16.
//  Copyright © 2015年 dlios. All rights reserved.
//

#import "CCFindDetailCell.h"

@implementation CCFindDetailCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.image = [[UIImageView alloc] initWithFrame:CGRectMake(10 * suitableScreen_Width, 10 * suitableScreen_Width, mainScreen_Width / 4, mainScreen_Width * 3 / 16)];
        [self.contentView addSubview:self.image];
        
        self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.image.frame.size.width + 20 * suitableScreen_Width, 10 * suitableScreen_Width, mainScreen_Width - self.image.frame.size.width - 30 * suitableScreen_Width, 20 * suitableScreen_Width)];
        [self.nameLabel setFont:[UIFont systemFontOfSize:16.0]];
        [self.contentView addSubview:self.nameLabel];
        
        self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.image.frame.size.width + 20 * suitableScreen_Width, 30 * suitableScreen_Width, mainScreen_Width - self.image.frame.size.width - 30 * suitableScreen_Width, 20 * suitableScreen_Width)];
        [self.priceLabel setFont:[UIFont systemFontOfSize:14.0]];
        [self.priceLabel setTextColor:[UIColor redColor]];
        [self.contentView addSubview:self.priceLabel];
        
        self.kindLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.image.frame.size.width + 20 *suitableScreen_Width, 50 * suitableScreen_Width, mainScreen_Width - self.image.frame.size.width - 30 * suitableScreen_Width, 20 * suitableScreen_Width)];
        [self.kindLabel setFont:[UIFont systemFontOfSize:14.0]];
        [self.contentView addSubview:self.kindLabel];
        
        [self setSelectionStyle:UITableViewCellSelectionStyleNone];
        
    }
    return self;
}


- (void)getInfo:(CCFindDetailModel *)model
{
    [self.image sd_setImageWithURL:[NSURL URLWithString:model.photo]placeholderImage:[UIImage imageNamed:@"zhanweitu"]];
    [self.nameLabel setText:model.name];
    [self.priceLabel setText:model.priceRange];
    [self.kindLabel setText:model.kind];
}

-(void)getCo:(CCFindHeadModel *)model
{
    [self.image sd_setImageWithURL:[NSURL URLWithString:model.imgurl]placeholderImage:[UIImage imageNamed:@"zhanweitu"]];
    
    [self.nameLabel setText:model.name];
    [self.priceLabel setText:model.price];
    [self.kindLabel setText:model.levelname];
}

@end
